#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QFileDialog>
#include <QMap>
#include <QDirIterator>
#include <QStringListModel>

QT_BEGIN_NAMESPACE
namespace Ui
{
    class Widget;
}
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    QMap<QString, QStringList> resultMap;
    QStringListModel *m_qStrListModel; // 数据模型

private slots:
    void on_pushButton_clicked();

    void on_comboBox_currentTextChanged(const QString &arg1);

    void on_pushButtonAdd_clicked();

    void on_pushButtonDel_clicked();

private:
    Ui::Widget *ui;
};


struct SearchResult {
    qint64 position;
    int lineNumber;
    QString lineContent;
};
std::vector<SearchResult> searchWithLineNumbers(const QString &filePath, const QByteArray &searchPattern);
QStringList getAllFiles(const QString &directoryPath);
QStringList getFilesWithFilter(const QString &directoryPath, const QStringList &nameFilters);
#endif // WIDGET_H
